#!/usr/bin python3
# -*- coding: utf-8 -*-
"""登录api接口"""
from flask import jsonify, request, make_response
from flask import Blueprint

from gtm_server.services.login import authentication

login_bp = Blueprint("login", __name__, url_prefix="/login")


@login_bp.route("", methods=["POST"])
def api_login():
    """
    登录接口
    """
    request_data = request.json
    account = request_data.get("account", None)
    password = request_data.get("password", None)
    login_state = authentication(account, password)
    response = make_response(jsonify(login_state))
    return response

